package com.java.mytest_ysy.a.demo1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/*有四名学生参加注册会计师考试,表格中记录的是4名学生的考试成绩,
请按照成绩将四名学生从小到大进行排名,并将结果展示出来.*/
public class Test {
    public static void main(String[] args) {
        List<Student> list=new ArrayList<>();
        Student s1=new Student("小明",57);
        Student s2=new Student("小白",87);
        Student s3=new Student("小绿",67);
        Student s4=new Student("小红",97);
        Collections.addAll(list,s1,s2,s3,s4);
        Collections.sort(list, (o1,o2)->Double.compare(o1.getScore(),o2.getScore()));
        list.forEach(System.out::println);
    }
}
